#pragma once

#include <iostream>
#include <unistd.h>
#include <fcntl.h>

#include "log.hpp"

class Util
{
public:
    static void setNonBlockSocket(int sock)
    {
        int falgs = fcntl(sock, F_GETFD);
        
        falgs |= O_NONBLOCK;
        int n = fcntl(sock,F_SETFL,falgs);
        
        if( n < 0)
            logMessage(WARNING,"sock = %d setNonBlockSocket fail",sock);

    }
};